package com.mills.gamebase.service;

import org.apache.log4j.Logger;

/**
 * Diese Klasse soll den ServletKontextPath halten,
 * also z.B.: http://server/context
 * 
 * @author mills
 *
 */
public class ServletContextPathHolder {

	private static Logger logger = Logger.getLogger(ServletContextPathHolder.class);
	
	private static ServletContextPathHolder servletContextPathHolder;
	private String servletContextPath;
	
	public static ServletContextPathHolder getInstance() {
		if (servletContextPathHolder == null) {
			if (logger.isDebugEnabled()) {
				logger.debug("Initiating ServletContextPathHolder...");
			}
			
			servletContextPathHolder = new ServletContextPathHolder();
		}
		
		return servletContextPathHolder;
	}
	
	public boolean isSet() {
		return servletContextPath != null;
	}
	
	public String getServletContextPath() {
		return servletContextPath;
	}
	
	public void setServletContextPath(String servletContextPath) {
		if (logger.isDebugEnabled()) {
			logger.debug("Setting ServletContextPath...");
		}
		
		this.servletContextPath = servletContextPath;
	}
}
